{extend name="shared/layout" /}
{block name="title"}修改昵称{/block}
{block name="css"}
{/block}
{block name="javascript"}
    <script type="text/javascript">
         $(document).ready(function () {
            $("#ok").bind("click", Save);
            $("#cancel").bind("click", function () {
                parent.layer.close(parent.layer_edit_index);
            });
         })
    
         function Save() {
           var couresname = $.trim($("input[name=nick_name]").val());
            if (couresname.length == 0) {                
                layer.tips('昵称不能为空！', 'input[name=nick_name]', { tips: [2, '#78BA32'] });
                return false;
            }
            layui.use(['layer'], function(){
                var load_index = layer.load(0, { shade: false });
                $.ajax({
                    type: "post",
                    url: "{:url('formid/edituser')}?t=" + new Date(),
                    data: $("form").serialize(),
                    dataType: "json",
                    success: function (result) {
                        layer.close(load_index);
                        if (result.code == 0) {
                            layer.alert('修改成功！', function () {
                                if (typeof (parent.initTable) == "function")
                                    parent.initTable();
                                parent.layer.close(parent.layer_edit_index)
                            });
                        } else {
                            layer.alert(result.msg);
                        }
                    }
                });
            })
        }
    </script>
{/block}
{block name="content"}
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form method="post" id="fmNew" class="form-horizontal">                            
                            <input type="hidden" name="id" value="{$data.id}" />                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">OPENID：</label>
                                <div class="col-sm-8">
                                    <label class="control-label">{$data.openid}</label>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">OPENID：</label>
                                <div class="col-sm-8">
                                    <label class="control-label">{$data.original_name}</label>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">昵称：</label>
                                <div class="col-sm-3">
                                    <input type="text" id="txtnickname" name="nick_name" value="{$data.nick_name}" class="form-control" placeholder="用户昵称">
                                </div>
                            </div>                            
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-12 col-sm-offset-5">
                                    <button class="btn btn-primary" id="ok" type="button">提交</button>
                                    <button class="btn btn-white" id="cancel" type="button">取消</button>
                                </div>
                            </div>
                        </div>                        
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>        
{/block}